

check <- function(contrib, candid, data) {
  tmp <-
    data[data$ContributorEID == contrib &
           data$CandidateName == candid, ]
  amount <- sum(tmp[,3])
  return(amount)
}


inverse.logit <- function(x)
  1 / (1 + exp(-x))



groups <-
  c(
    "Health",
    "Uncoded",
    "Government Agencies/Education/Other",
    "Lawyers & Lobbyists",
    "Ideology/Single Issue",
    "Construction",
    "Labor",
    "Candidate Contributions",
    "Party",
    "Finance, Insurance & Real Estate",
    "General Business",
    "Communications & Electronics",
    "Transportation",
    "Energy & Natural Resources",
    "Agriculture",
    "Unitemized Contributions",
    "Defense",
    "Non-Contributions",
    "Public Subsidy"
  )
group.colors <-
  c(
    "#771155",
    "#AA4488",
    "#CC99BB",
    "#114477",
    "#4477AA",
    "#77AADD",
    "#117777",
    "#44AAAA",
    "#77CCCC",
    "#117744",
    "#44AA77",
    "#88CCAA",
    "#777711",
    "#AAAA44",
    "#DDDD77",
    "#774411",
    "#AA7744",
    "#DDAA77",
    "#771122",
    "#AA4455",
    "#DD7788"
  )
group.ids <-
  c(8, 14, 9, 11, 10, 2, 12, 17, 15, 6, 7, 3, 13, 5, 1, 16, 4, 18, 19)

groups <- groups[order(group.ids)]
group.ids <- sort(group.ids)

colors <- colorpanel(101,
                     low = "red",
                     mid = "white",
                     high = "blue")
